class Solution {
public:
    ListNode* deleteDuplicates(ListNode* head) {
        ListNode *guard=new ListNode(0);
        guard->next=head;
        ListNode *ind0=guard;
        while(ind0->next!=NULL&&ind0->next->next!=NULL){
            if(ind0->next->val == ind0->next->next->val){//需要删除
                int repitition=ind0->next->val;
                while(ind0->next!=NULL&&ind0->next->val==repitition){
                    ind0->next=ind0->next->next;
                }
            }else{
                ind0=ind0->next;
            }
        }
        return guard->next;
    }
};